const express = require("express");
const cors = require("cors");

const server = express();


//跨域的问题
server.use(cors());
//配置中间件 post让body拿到数据,就这样配置
server.use(express.urlencoded({ extended: false }));
server.use(express.json());

//静态资源
server.use(express.static("./public"));
//把 ../src下的资源,当前我服务器的 静态资源
server.use(express.static("../src"));


server.use("/api", require("./routes/apiRouter").ApiRouter);
server.use("/goods", require("./routes/goodsRouter").GoodsRouter);


server.listen(8080, function () {
    console.log("zouxiu02..启动完毕!");
})